package edu.task.snake.model;


import java.awt.event.ActionEvent;

public class Frog extends Character implements Position {
    int x = 0;
    int y = 0;
    private int delay;

    public Frog() {
    }

    public Frog(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }


    public void run() {
        long beforeTime, timeDiff, sleep;

        beforeTime = System.currentTimeMillis();

        while (true) {
//check free space - collision detect? then move then sleep;

            /*position.cycle(); //todo
            fireActionPerformed(new ActionEvent(Frog.this, 1, getActionCommand(), System.currentTimeMillis(), 0));//todo send event to View

            timeDiff = System.currentTimeMillis() - beforeTime;
            sleep = DELAY -timeDiff;//todo

            if (sleep < 0) {
                sleep = 2;
            }

            try {
                Thread.sleep(sleep);
            } catch (InterruptedException e) {
                System.out.println("Interrupted: " + e.getMessage());
            }
*/
            beforeTime = System.currentTimeMillis();
        }
    }
}
